<!DOCTYPE html>
<html>
<#include "../head.html">
<body>
	<table class="mc">
		<tr>
			<td class="mc-l">
				<!--左侧导航---{-->
				<div id="navPanelContainer">
					<div class="system-logo cd"></div>
					<!--管理员信息---{-->
					<#include "../adminInfo.html">
					<!--管理员信息---}-->
					<div class="nav-wrap">
					<!-- v1.6.6.2 RDPROJECT-238 lhm 2013-10-21 start -->
					<#include "../setting/left.html">
					<!-- v1.6.6.2 RDPROJECT-238 lhm 2013-10-21 end -->
					</div>
				</div> 
				<!--左侧导航---}-->
			</td>
			<td class="mc-m">
				<div class="navToggle"></div>
			</td>
			<td class="mc-r">
				<!--顶部导航---{--> 
				<#include "../topNav.html"> 
				<!--顶部导航---}--> 
				<!--面包屑导航---{-->
				<!-- v1.6.5.3 RDPROJECT-39 zza 2013-09-16 start -->
				<#assign moduleName="图片管理"> 
				<!-- v1.6.5.3 RDPROJECT-162 zza 2013-09-16 end -->
				<!-- v1.6.6.2 RDPROJECT-238 lhm 2013-10-21 start -->
				<#include "../setting/banner.html"> 
				<!-- v1.6.6.2 RDPROJECT-238 lhm 2013-10-21 end -->
				<!--面包屑导航---}-->

				<!--工具栏--{-->
				<div id="toolbar" class="clearfix">
					<input type="button" class="input-button return" value="返回" onclick="javascript:location.href='showScrollPic.html'">
				</div> <!--工具栏--}--> 
				<script>
				$(function(){
                 	//document.write(extArray.join("  "));
				});
                </script>
				<div id="main" class="w750 clearfix">

					<form name="form1" method="post" action="" enctype="multipart/form-data">
						<div class="valBox">
							<div class="top">
								<strong>添加图片</strong>
							</div>
							<div class="clearfix">
								<ul class="title-v edit">
									<li><!-- v1.6.5.3 RDPROJECT-39 zza 2013-09-16 start -->
										<div class="title">文字说明：</div>
										<!-- v1.6.5.3 RDPROJECT-39 zza 2013-09-16 end -->
										<div class="v">
											<input type="text" name="name" class="input_border" />
										</div>
									</li>

									<li>
										<div class="title">图片：</div>
										<div class="v">
											<!--  <textarea name="content" id="pic" style="width:500px;height:200px;visibility:hidden;"  class="ckeditor"></textarea> -->
											<input type="file" name="pic" class="input_border" />
										</div>
									</li>
									<li>
										<div class="title">图片类型：</div>
										<div class="v">
											<input type="radio" name="type_id" value="1">首页滚动图片 
											<input type="radio" name="type_id" value="2">合作伙伴 
											<input type="radio" name="type_id" value="3">友情链接
										</div>
									</li>
									<li>
										<div class="title">排序：</div>
										<div class="v">
											<input type="text" name="sort" class="input_border" value="" size="10" onKeyUp="value=value.replace(/[^0-9]/g,'')"/>
										</div>
									</li>
									<li>
										<div class="title">跳转网址：</div>
										<div class="v">
											<!-- v1.6.6.2 RDPROJECT-377 lhm 2013-10-24 start -->
											<input type="text" name="url" class="input_border" value="" size="120" />
											<!-- v1.6.6.2 RDPROJECT-377 lhm 2013-10-24 end -->
										</div>
									</li>
									<li>
										<span style="color: red;">* 首页滚动图片一定要上传图片，如果合作伙伴、友情链接在首页显示的是文字，图片不用上传！</span>
									</li>
								</ul>
							</div>

						</div>

						<div id="bottomToolbar" class="clearfix">
							<input type="hidden" name="actionType" value="addScrollPic" /> 
							<input class="input-button post" type="button" name="Submit" value="提交" onclick="LimitAttach(this.form, this.form.pic.value)" /> 
							<input class="input-button post" type="reset" name="reset" value="重置" />
						</div>
					</form>
				</div> 
				<script>
					var extArray = new Array(".gif", ".jpg", ".png");
					function LimitAttach(form, file) {
						<!-- v1.6.5.3 RDPROJECT-39  zza 2013-09-12 start -->
						var val=$('input:radio[name="type_id"]:checked').val();
						var textBox = $("input[name='name']");
						var textVal = textBox.val()
						textBox.parent().find("span").remove();
						if(val=="2"||val=="3")
						{
							console.log(textBox.parent())
							if(textVal!=""){
								form.submit();
							} else {
								if(file=="") {
									textBox.parent().append("<span style='color:#f00'>必须输入名称</span>")
								} else{
									form.submit();
								}
							}
						}
						<!-- v1.6.5.3 RDPROJECT-39  zza 2013-09-12 end -->
						allowSubmit = false;
						if (!file) {
							return;
						}
						while (file.indexOf("\\") != -1)
							file = file.slice(file.indexOf("\\") + 1);
						ext = file.slice(file.indexOf(".")).toLowerCase();
						for ( var i = 0; i < extArray.length; i++) {
							if (extArray[i] == ext) {
								allowSubmit = true;
								break;
							}
						}
						if (allowSubmit) {
							if(val==1){
								if(ext!=""){
									form.submit();
								}
							}
						} else {
							alert("对不起，只能上传以下格式的文件：" + (extArray.join("  "))
									+ "\n请重新选择符合条件的文件" + "再上传！");
							return false;
						}
					}
				</script>
			</td>
		</tr>
		<tr>
			<!--尾部--{-->
			<td colspan="3" class="mc-b"><#include "../foot.html"></td>
			<!--尾部--}-->
		</tr>
	</table>
	<div class="msgClass">${rsmsg!""}</div>
</body>
</html>
<#include "../jsPage.html">
